<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <html>
            <head>
                <link href="/css/bootstrap.css" rel="stylesheet" media="screen"/>
                <link href="/css/docs.css" rel="stylesheet" media="screen"/>
                <link href="/css/bootstrap-responsive.css" rel="stylesheet" media="screen"/>
                <meta http-equiv="refresh" content="3"/>
                <meta charset="UTF-8"/>
                <title>Агенты и очереди звонков</title>
            </head>
            <body>
                <div style="margin-top: 20px">
                    <div class="container">
                        <div class="row">
                            <div class="span3 bs-docs-sidebar">
                                <ul class="nav nav-list affix bs-docs-sidenav">
                                    <li class="active">
                                        <a href="/service/agents/and/queues">
                                            <!--<i class="icon-chevron-right"/>-->
                                            Агенты и очереди звонков
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/service/show/hunt/groups">
                                            <!--<i class="icon-chevron-right"/>-->
                                            Подгруппы
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/service/show/call/hist">
                                            Распределение звонков
                                        </a>
                                    </li>
                                    <li class="dropdown-submenu">
                                        <a tabindex="-1" href="#">Статистика</a>
                                        <ul class="dropdown-menu">
                                            <li>
                                                <a href="/service/show/super/stats?units-count=12&amp;time-unit=hours">
                                                    12 часов
                                                </a>
                                            </li>
                                            <li>
                                                <a href="/service/show/super/stats?units-count=24&amp;time-unit=hours">
                                                    1 день
                                                </a>
                                            </li>
                                            <li>
                                                <a href="/service/show/super/stats?units-count=2&amp;time-unit=days">
                                                    2 дня
                                                </a>
                                            </li>
                                            <li>
                                                <a href="/service/show/super/stats?units-count=7&amp;time-unit=days">
                                                    1 неделя
                                                </a>
                                            </li>
                                            <li>
                                                <a href="/service/show/super/stats?units-count=30&amp;time-unit=days">
                                                    1 месяц
                                                </a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <a href="/service/log/out">
                                            <!--<i class="icon-chevron-right"/>-->
                                            Выход
                                        </a>
                                    </li>
                                </ul>
                            </div>
                            <div class="span9">
                                <div class="page-header">
                                    <h1>Агенты и очереди звонков</h1>
                                </div>
                                <h4>
                                    Менеджер смены:
                                    <xsl:for-each select="response/supervisors/user">
                                        <xsl:value-of select="./@name"/>
                                        <xsl:text> [</xsl:text>
                                        <xsl:value-of select="./@extension"/>
                                        <xsl:text>]</xsl:text>
                                        <xsl:text>, </xsl:text>
                                    </xsl:for-each>
                                </h4>
                                <h4 style="margin-top:50px">Агенты:</h4>
                                <table class="table table-bordered table-striped">
                                    <thead>
                                        <tr>
                                            <th>Агент</th>
                                            <th>Номер</th>
                                            <th>Завершено звонков</th>
                                            <th>Статус</th>
                                            <th>Время статуса</th>
                                            <xsl:for-each select="/response/hunt-groups/hunt-group">
                                                <th>
                                                    <xsl:value-of select="./@name"/>
                                                </th>
                                            </xsl:for-each>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <xsl:for-each select="/response/online-agents/user">
                                            <tr>
                                                <td><xsl:value-of select="./@name"/></td>
                                                <td><xsl:value-of select="./@extension"/></td>
                                                <td>
                                                    <a href="/service/show/super/stats?units-count=1&amp;time-unit=days&amp;filter-user-id={./@id}">
                                                        <xsl:value-of select="./@completed-calls"/>
                                                    </a>
                                                </td>
                                                <td><xsl:value-of select="./@state"/></td>
                                                <td><xsl:value-of select="./@state-time"/></td>
                                                <xsl:for-each select="hunt-group">
                                                    <td>
                                                        <xsl:if test="./@active = 'true'">
                                                            <xsl:text>in</xsl:text>
                                                        </xsl:if>
                                                    </td>
                                                </xsl:for-each>
                                            </tr>
                                        </xsl:for-each>
                                    </tbody>
                                </table>

                                <h4 style="margin-top:50px">Очереди звонков:</h4>
                                <table class="table table-bordered table-striped">
                                    <thead>
                                        <tr>
                                            <th>Подгруппа</th>
                                            <th>Номер</th>
                                            <th>Агентов всего</th>
                                            <th>Доступных агентов</th>
                                            <th>Звонков в очереди</th>
                                            <th>Время ожидания</th>
                                            <th>Завершено звонков</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <xsl:for-each select="/response/hunt-groups/hunt-group">
                                            <tr>
                                                <td><xsl:value-of select="@name"/></td>
                                                <td><xsl:value-of select="@extension"/></td>
                                                <td><xsl:value-of select="@agents-in"/></td>
                                                <td><xsl:value-of select="@avl-agents"/></td>
                                                <td><xsl:value-of select="@calls-holding"/></td>
                                                <td><xsl:value-of select="@hold-time"/></td>
                                                <td>
                                                    <a href="/service/show/super/stats?units-count=1&amp;time-unit=days&amp;hunt-group-id={./@id}">
                                                        <xsl:value-of select="@completed-calls"/>
                                                    </a>
                                                </td>
                                            </tr>
                                        </xsl:for-each>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>